//
//  PhoneDevice.swift
//  JiaoZiTaxi
//
//  Created by Hu Gang on 2022/9/18.
//

import Foundation
import KeychainAccess

struct PhoneDevice {
    var deviceId : UUID?
    var openId : String?
    
    init() {
        let bundleID = Bundle.main.bundleIdentifier!
        let keychain = Keychain(service: "\(bundleID).info")
        if let key = keychain["deviceid"] {
            deviceId = UUID(uuidString: key)
           print("deviceid:\(deviceId)")
        }
        else {
            deviceId = UUID()
            keychain["deviceid"] = deviceId?.uuidString
        }
    }
}
